<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        
            console.log('c start');//1 同步任务
            new Promise((resolve,reject)=>{
                console.log('Promise start');//2 同步任务

                resolve();
            }).then(()=>{
                console.log('then')//7
            })
            async function pp(){
                console.log('async pp');//3 同步任务
                await p();
            }
            function p(){
                setTimeout(()=>{
                    console.log('p time out')//8
                },0);
                console.log('p');//4 同步任务
            }
            var res = pp();
            console.log(res)//5 同步任务
            setTimeout(()=>{
                console.log('time out')//9
            },0);
            console.log('c end');//6 同步任务
    </script>
</body>
</html>